package com.uphone.magicleafteacher.pro.fragment.home;

import com.uphone.magicleafteacher.MyApp;
import com.uphone.magicleafteacher.base.mvp.BasePAV;
import com.uphone.magicleafteacher.http.ApiService;
import com.uphone.magicleafteacher.http.FailureConsumer;
import com.uphone.magicleafteacher.http.RxSchedulers;
import com.uphone.magicleafteacher.http.SuccessfulConsumer;
import com.uphone.magicleafteacher.util.CommonUtil;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;

/**
 * <pre>  *     author : radish  *     e-mail : 15703379121@163.com  *     time   : 2019/4/16  *     desc   :  * </pre>
 */
public class HomePresenter extends BasePAV<HomeContract.View> implements HomeContract.Presenter {

    HomeFragment homeFragment;
    public int page;

    @Inject
    public HomePresenter() {

    }


    @Override
    public void loadNetData(int page) {
        this.page = page;
        MyApp.apiService(ApiService.class)
                .otherLiveClass(CommonUtil.getTeacherId(), page + "", "10")
                .compose(RxSchedulers.io_main())
                .subscribe(new SuccessfulConsumer() {
                    @Override
                    public void success(String jsonObject) {
                        mView.updateUI(jsonObject);
                    }
                }, new FailureConsumer());
    }


}
